﻿using System.Configuration;
namespace Als.Common.String
{
    public static class ConfigHelper
    {
        #region 读取配置文件

        /// <summary>
        /// 数据库链接字符串
        /// </summary>
        /// <param name="inputStr"></param>
        /// <returns></returns>
        public static string ValueOfConnectionString(this string inputStr)
        {
            return ConfigurationManager.ConnectionStrings[inputStr].IsNull() ? null : ConfigurationManager.ConnectionStrings[inputStr].ConnectionString;
        }

        /// <summary>
        /// 自定义配置参数
        /// </summary>
        /// <param name="inputStr"></param>
        /// <returns></returns>
        public static string ValueOfAppSetting(this string inputStr)
        {
            return ConfigurationManager.AppSettings[inputStr];
        }

        #endregion



    }
}
